using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using TimeTableManagement.Entities;

namespace TimeTableManagement.Mapping
{
	public class Tb_DepartmentMap : EntityTypeConfiguration<Tb_Department>
	{
		public Tb_DepartmentMap()
		{
			// Primary Key
			this.HasKey(t => t.id);

			// Properties
			this.Property(t => t.code)
				.IsRequired()
				.HasMaxLength(10);
				
			this.Property(t => t.name)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.description)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Tb_Department");
			this.Property(t => t.id).HasColumnName("id");
			this.Property(t => t.code).HasColumnName("code");
			this.Property(t => t.name).HasColumnName("name");
			this.Property(t => t.description).HasColumnName("description");
		}
	}
}

